package com.cheng.example.book.advise151.chap2;

import java.util.ArrayList;
import java.util.List;

/**
 * 建议26：提防包装类型的null值
 *
 */
public class Client26 {

    public static int testMethod(List<Integer> list) {
        int count = 0;
        for (int i : list) {
            count += i;
        }
        return count;
    }

        public static void main(String[] args) {
            List<Integer> list = new ArrayList<Integer>();
            list.add(1);
            list.add(2);
            list.add(null);
            list.add(null);

        System.out.println(list.size());
//        System.out.println(testMethod(list));

    }
}